﻿//using System.Threading.Tasks;
//using Volo.Abp.Caching;
//using Volo.Abp.DependencyInjection;
//using Volo.Abp.Domain.Entities.Events;
//using Volo.Abp.EventBus;

//namespace SettingsManagement;

//public class SettingCacheItemInvalidator : ILocalEventHandler<EntityChangedEventData<Setting>>, ITransientDependency
//{
//    protected ISettingsCacheContext SettingsCacheContext { get; }

//    public SettingCacheItemInvalidator(ISettingsCacheContext settingsCacheContext)
//    {
//        SettingsCacheContext = settingsCacheContext;
//    }

//    public virtual async Task HandleEventAsync(EntityChangedEventData<Setting> eventData)
//    {
//        var cacheKey = CalculateCacheKey(
//            eventData.Entity.Name,
//            eventData.Entity.ProviderName,
//            eventData.Entity.ProviderKey
//        );

//        await SettingsCacheContext.GetSettings(eventData.Entity.Name).RemoveAsync(cacheKey, considerUow: true);
//    }

//    protected virtual string CalculateCacheKey(string name, string providerName, string providerKey)
//    {
//        return SettingCacheItem.CalculateCacheKey(name, providerName, providerKey);
//    }
//}
